package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.domain.NursingProject;
import com.zzyl.nursing.dto.NursingProjectDto;
import com.zzyl.nursing.service.INursingProjectService;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/member/orders/project")
public class MemberOrdersProjectController extends BaseController {

    /**
     * 分页查询护理项目列表
     *
     * @param nursingProjectDto
     * @return
     */
    //mybatis的书写方式
    /*@GetMapping("/page")
    public TableDataInfo<List<NursingProject>> getAllProjects(NursingProject nursingProject) {
        startPage();
        List<NursingProject> list = nursingProjectService.selectNursingProjectList(nursingProject);
        return getDataTable(list);
    }*/


    //mybatis-plus的书写方式
    @GetMapping("/page")
    public TableDataInfo<NursingProject> pageQueryNursingProject(NursingProjectDto nursingProjectDto) {
        TableDataInfo<NursingProject> list = nursingProjectService.pageQueryNursingProject(nursingProjectDto);
        return list;
    }

    @Autowired
    private INursingProjectService nursingProjectService;

    /**
     * 根据编号查询护理项目信息
     *
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public R<NursingProject> getInfo(@ApiParam("护理项目ID") @PathVariable("id") Long id) {
        return R.ok(nursingProjectService.selectNursingProjectById(id));
    }
}
